# gcolor2
# Builds from https://github.com/puppylinux-woof-CE/petbuilds

. ../func
. ../build.conf

URL=http://downloads.sourceforge.net/project/gcolor2/gcolor2/0.4/
PKG=gcolor2
VER=0.4
SRCV=gcolor2
COMP=tar.bz2
DESC="gtk color picker"
DEPS=+gtk+2
CAT=Graphic
DESKTOP=gcolor2.desktop
BUILD=
CWD=$(pwd)
[ -z "$MWD" ] && MWD=$(dirname $CWD)	
[ -z "$BUILD" ] && BUILD=$DEF_BUILD
[ -f "$DESKTOP" ] || DESKTOP=not
[ -z "$DEPS" ] && DEPS=not	

ARCH=$(uname -m)
case $ARCH in
 *64) 	LIBDIR=$LIBCONF64 ;;
 arm*)	LIBDIR=$LIBCONFarm;;
 *) 	LIBDIR=$LIBCONF32 ;;
esac

patch_me() {
	for i in *.patch; do 
		echo "applying $i"
		patch -p0 --verbose < $i
	done
}

build() {
	cd ${SRCV}-${VER}
	# fix configure 
	sed -i~ '/gentoo_ltmain_version/s/\[:space:\]/[&]/g' configure
	./configure \
		--prefix=/usr
	[ "$?" -eq 0 ] || exit
	make
	[ "$?" -eq 0 ] || exit
	make DESTDIR=$CWD/${PKG}-install install-strip
	cd -
}
	
# main
retrieve ${SRCV}-${VER}.${COMP}
extract ${SRCV}-${VER}.${COMP}
patch_me
build
package_std $PKG $VER $ARCH $DESKTOP "$DESC" $DEPS $CAT
